#!/bin/bash
#申请钉钉智能机器人后有一个可以请求的url，替换下面的url就好
title=$1
body=$2
DATE=`date +%Y-%m-%d-%H:%M:%S`
webhook='https://oapi.dingtalk.com/robot/send?access_token=504394581b07d65382fe71fb2bf15d542794c8527a290ca1b9a2a46f7ecf0b67'
                dingdingMsg=`cat <<EOF
                        {
                            "msgtype": "text",
                            "text": {
                               "content": "监控标题：$title
							   构建时间：$DATE
							   $body"
                            },
							"isAtAll": true
                        }
EOF`

#               result=$(curl -X POST -H "Content-Type: application/json"  https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=$accessToken -d "$message" )
                result=$(curl  -X POST -H 'Content-Type: application/json' $webhook -d "$dingdingMsg")
		echo "$result"